]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
switchMonitor: Fix initial selection on desktop
authorYao Wei (魏銘廷) <yao.wei@canonical.com>
Mon, 29 Aug 2022 08:45:05 +0000 (16:45 +0800)
committerYao Wei <mwei@lxde.org>
Wed, 31 Aug 2022 00:38:49 +0000 (00:38 +0000)
Due to !2056 the monitor config is 2 instead of 4 on the desktop.
However, the constant `Meta.MonitorSwitchConfigType.UNKNOWN` is fixed to
4, and may cause the initial selection to be out of index thus fail to
display the switcher.  This replaces the above constant to the actual
length of the switcher items.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2451>

js/ui/switchMonitor.js

index 10b4a50cde2f0ead512c2b7925cef9ca7e126417..a95c5fa9ada9a23e8ef18b95d47698a7ed95be3d 100644 (file)
@@ -63,7 +63,7 @@ class SwitchMonitorPopup extends SwitcherPopup.SwitcherPopup {
 
     _initialSelection() {
         let currentConfig = Meta.MonitorManager.get().get_switch_config();
-        let selectConfig = (currentConfig + 1) % Meta.MonitorSwitchConfigType.UNKNOWN;
+        let selectConfig = (currentConfig + 1) % this._items.length;
         this._select(selectConfig);
     }